/**
 * vuex 用户状态管理模块
 */
let lifeData = uni.getStorageSync('lifeData') || {}

let $user = lifeData.$user || {}

export default {
  namespaced: true,
  state: {
    userInfo: $user.userInfo || {},
    permission: $user.permission || [],
    inviteCode: $user.inviteCode || ''
  },
  getters: {},
  actions: {
    // 获取用户信息
    async getUserInfo(state, userInfo) {
      console.log('666==> ', 666)
      let res = await api.getUserInfo()
      vk.vuex.set('$user.userInfo', res.data.userInfo)
    }
  },
  mutations: {}
}
